package aop05;

import aop02.SomeException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Author:shixiaojun@itany.com
 * Date:2022/5/17 16:59
 * Version:1.0-SNAPSHOT
 * Description:
 */
public class Test {

    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("aop05/spring.xml");
        SomeService someService = (SomeService) ac.getBean("someService");
        someService.doSome();
        System.out.println("-------------------------");
        someService.doSome("admin");
        System.out.println("-------------------------");
        someService.doSome("admin","alice");
        System.out.println("-------------------------");
        try {
            someService.doOther();
        } catch (SomeException e) {
        }
        System.out.println("-------------------------");
        someService.add(1,2);
        System.out.println("-------------------------");
        OtherService otherService = (OtherService) ac.getBean("otherService");
        otherService.doSome();
        System.out.println("-------------------------");
        otherService.doOther();
        System.out.println("-------------------------");
        UserService userService = (UserService) ac.getBean("userService");
        userService.doSome();
        System.out.println("-------------------------");
        userService.login();
        System.out.println("-------------------------");
        userService.register();
    }

}
